package io;

import java.io.*;
import java.nio.charset.StandardCharsets;

/*
* 内部维护一个默认8KB长度的char数组，以块读写形式读写字符以提高读写效率
* */
public class PWDemo {
    public static void main(String[] args) throws IOException {
        PrintWriter pw = new PrintWriter("pw.txt");
        pw.println("和我在成都的街头走一走");
        pw.println("直到所有的等都熄灭了也不停留");
        System.out.println("写出完毕");
        pw.close();
        /*FileOutputStream fos = new FileOutputStream("pw.txt");
        OutputStreamWriter osw = new OutputStreamWriter(fos, StandardCharsets.UTF_8);
        BufferedWriter bw = new BufferedWriter(osw);//缓冲字符流
        bw.write("和我在成都的街头走一走");
        bw.write("直到所有的等都熄灭了也不停留");
        System.out.println("写出完毕");
        bw.close();*/
    }
}
